java while loop with string condition